HADOOP-17990. Fix failing concurrent FS.initialize commands when fs.azure.createRemoteFileSystemDuringInitialization is enabled.#3620
Conversation
…zure.createRemoteFileSystemDuringInitialization is enabled.
|
💔 -1 overall
This message was automatically generated. |
| if (ex instanceof AzureBlobFileSystemException) { | ||
| checkException(null, (AzureBlobFileSystemException) ex, | ||
| AzureServiceErrorCode.FILE_SYSTEM_ALREADY_EXISTS); | ||
| } else if (ex.getCause() != null && ex.getCause() instanceof AzureBlobFileSystemException) { |
There was a problem hiding this comment.
instanceof always returns false if source is null, so the null check here can be removed
| try { | ||
| this.createFileSystem(tracingContext); | ||
| } catch (IOException ex) { | ||
| if (ex instanceof AzureBlobFileSystemException) { |
There was a problem hiding this comment.
better to add a catch(AzureBlobFileSystemException) clause
|
|
||
| @Test | ||
| public void ensureFilesystemWillBeCreatedIfCreationConfigIsSet() throws Exception { | ||
| final AzureBlobFileSystem fs = createFileSystem(); |
There was a problem hiding this comment.
use try with resources to close afterwards
| final MockAzureBlobFileSystemStore store = new MockAzureBlobFileSystemStore(config); | ||
| fs.setAbfsStore(store); | ||
| fs.createFileSystemIfNotExist(getTestTracingContext(fs, true)); | ||
| assert(store.isCreateFileSystemCalled); |
There was a problem hiding this comment.
assertj assertions with useful error text
|
had a quick look at the code
example #3611 (comment) |
|
💔 -1 overall
This message was automatically generated. |
|
Thanks for the review, I have addressed the commets.
Test result output |
|
I saw this compilation error coming from Yetus, is this expected? |
|
yetus has been a bit flaky recently (I managed to break trunk & 3.3; some docker image/openssl issues, but these seem new) style |
|
💔 -1 overall
This message was automatically generated. |
|
We're closing this stale PR because it has been open for 100 days with no activity. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. |
Description of PR
When fs.azure.createRemoteFileSystemDuringInitialization is enabled, the filesystem will create a container if it does not already exist inside the initialize method. The current flow of creating the container will fail in the case of concurrent initialize methods being executed simultaneously (only one request can create the container, the rest will fail instead of moving on). This PR is fixing this issue by also catching org.apache.Hadoop.fs.FileAlreadyExistsException generated by the createFilesystem command.
How was this patch tested?
A new test in ITestAzureBlobFileSystemInitAndCreate is introduced which was breaking before the fox.
For code changes:
LICENSE,LICENSE-binary,NOTICE-binaryfiles?